package com.ruibang.glass.etl.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;

import lombok.Data;
import org.apache.commons.lang3.StringUtils;

/**
 * <p>
 * 
 * </p>
 *
 * @author Auto-generator
 * @since 2024-04-19
 */

@ApiModel(value ="")
@TableName("bc_station_zq_detail")
@Data
public class BcStationZqDetail {

    @TableId(value = "_id")
    private String id;
    private String zqRightCutterLineStatus;
    @TableField("ZQJ_GlassID_IN")
    private String zqjGlassidIn;
    @TableField("GlassID")
    private String GlassID;
    @TableField("QG_Comp")
    private String qgComp;
    @TableField("ZQJ_GlassID_OUT")
    private String zqjGlassidOut;
    @TableField("ZQJ_equipment_status")
    private String zqjEquipmentStatus;
    @TableField("ZQJ_broken")
    private String zqjBroken;
    @TableField("ZQJ_operation_mode")
    private String zqjOperationMode;
    private String zqRightCutterPressure;
    private String zqLeftCutterOnceCutLength;
    private String zqLeftCutterPressure;
    private String zqRightCutterCutSpeed;
    private String zqRightCutterOnceCutLength;
    private String zqLeftCutterCutLength;
    @TableField("ZQJ_broken_glassID")
    private String zqjBrokenGlassid;
    private String zqCutterLengthSetting;
    private String zqRightCutterCutLength;
    private String zqLeftCutterCutSpeed;
    private String zqRightCutterTemperature;
    private String zqLeftCutterTemperature;
    private String zqRightStartPosition;
    private String zqRightBackPosition;
    private String zqLeftStartPosition;
    private String zqLeftBackPosition;
    private String zqLeftCutterLineStatus;
    private String zqLeftMicrometerScale;
    private String zqRightMicrometerScale;
    @TableField("ZQJ_Lost_board_count")
    private String zqjLostBoardCount;
    private String stationStartTime;
    private String stationCompleteTime;
    private String stationProductionTime;
    private String zqHxfhsd;
    private String zqYdwz;
    private String zqHdwz;
    private String productionLineCode;
    private String stationId;
    private String tag;
    private String glassId;
    private String tagOut;
    private String stationStartTimeOrg;
    private String stationCompleteTimeOrg;
    private String station;
    private String table;
    private String dataType;
    private String createTime;
    @TableField("tagText")
    private String tagText;

    public void setCreateTime(String createTime){

        this.createTime = createTime;
    }

    public String getCreateTime(){
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
        if(StringUtils.isNotBlank(createTime) && createTime.matches("\\d+")){
            Instant instant = Instant.ofEpochMilli(Long.parseLong(createTime));
            ZoneId zone = ZoneId.systemDefault();
            return LocalDateTime.ofInstant(instant, zone).format(formatter);
        }
        return LocalDateTime.now().format(formatter);
    }
}
